﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace cn.sunchis.pvuv.sdk.model
{
    /// <summary>
    /// PVUV数据模型
    /// <para>@Author 许亮</para>
    /// <para>@Create 2018-7-4 16:25:55</para>
    /// </summary>
    public class Pvuv
    {
        public string _id { get; set; }

        /// <summary>
        /// 应用系统名，例如百度云，该系统由多个业务组件组成
        /// </summary>
        public string sys { get; set; }

        /// <summary>
        /// 应用组件ID/名称
        /// </summary>
        public string com { get; set; }

        /// <summary>
        /// <para>运行应用组件的服务器主机标识，考虑到服务器上同时运行多个组件的可能性</para>
        /// <para>所以服务器标识组成格式为：{主机名}:{组件服务监听端口}</para>
        /// </summary>
        public string host { get; set; }

        /// <summary>
        /// 请求的URL地址
        /// </summary>
        public string url { get; set; }

        /// <summary>
        /// 用户会话ID/标识
        /// </summary>
        public string sid { get; set; }

        /// <summary>
        /// 用户访问时间戳
        /// </summary>
        public DateTime stamp { get; set; }

        /// <summary>
        /// 设置主机标识
        /// </summary>
        /// <param name="hostname">主机名</param>
        /// <param name="listenPort">服务监听端口号</param>
        public void setHost(string hostname, int listenPort) {
            this.host = string.Format("{0}:{1}", hostname, listenPort);
        }
    }
}
